package com.ls.uav_backend.task;

import com.ls.uav_backend.service.EnvironmentalDataService;
import jakarta.annotation.Resource;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class EnvironmentDataTask {

    @Resource
    private EnvironmentalDataService environmentalDataService;

    @Scheduled(initialDelay = 2000, fixedDelay = 7200000)
    public void fetchEnvironmentData() {
        environmentalDataService.get24HEnvironmentalData();
    }

    @Scheduled(fixedRate = 7200000)
    public void setEnvironmentData() {
        environmentalDataService.updateCurrentEnvironmentalData();
    }

}
